/*
 * Copyright 2020-2030 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.gitee.minimalismstyle.fresh.oss.config

import org.apache.commons.net.ftp.FTPClient
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.context.annotation.Configuration

/**
 * 对象存储配置参数
 * @author maoxiaodong
 */
@Configuration
@ConfigurationProperties(prefix = "fresh.oss")
class OssProperties {

    /**
     * 存储仓库(目前支持的local、db、ftp、fastDFS、gridFs)，默认本地
     */
    var store = "local"

    var local = Local()

    var ftp = Ftp()

    var mongo = Mongo()

    class Local {
        /**
         * 本地存储根路径，默认classes:/upload
         */
        var rootPath = "classes:/upload"
    }

    class Ftp {
        /**
         * ftp ip，默认127.0.0.1
         */
        var host = "127.0.0.1"

        /**
         * ftp port，默认21
         */
        var port = 21

        /**
         * ftp 用户名，默认admin
         */
        var username = "admin"

        /**
         * ftp 密码，默认123
         */
        var password = "123"

        /**
         * ftp 模式，默认active
         */
        var mode = "active"

        /**
         * ftp 编码，默认UTF-8
         */
        var controlEncoding = "UTF-8"

        /**
         * ftp 文件类型，默认二进制
         */
        var fileType = FTPClient.BINARY_FILE_TYPE

        /**
         * 文件根路径，默认/
         */
        var rootPath = "/"
    }

    class Mongo{

        /**
         * mongo 文件存储数据库，默认fresh-oss
         */
        var database = "fresh-oss"
    }

}